﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace 计科2111林开心
{
    public partial class _1_6 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }

        protected void ListBox1_TextChanged(object sender, EventArgs e)
        {

           
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if(ListBox1.SelectedIndex==-1)
            ListBox1.Items.Add(TextBox1.Text);
            else 
            ListBox1.Items.Insert(ListBox1.SelectedIndex, TextBox1.Text);

            
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            ListBox1.Items.RemoveAt(ListBox1.SelectedIndex);
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            ListBox2.Items.Clear();
            ListBox2.Items.Add(ListBox1.SelectedValue);
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            ListBox2.Items.Clear();
            for (int i=0; i<ListBox1.Items.Count;i++)
            { 
                ListBox2.Items.Add(ListBox1.Items[i].Value);
            }
           
        }
    }
}